package service.impl;

import bean.dto.AnnouncementPage;
import bean.dto.EquipmentPage;
import bean.pojo.Announcement;
import dao.AnnouncementDao;
import dao.impl.AnnouncementDaoImpl;
import service.AnnouncementService;

import java.util.List;

/**
 * service.impl
 * User: xlh
 * Date: 2024/12/23 14:25
 * motto:推到高塔
 * Description:
 * Version: V1.0
 */
public class AnnouncementServiceImpl implements AnnouncementService {
    AnnouncementDao announcementDao=new AnnouncementDaoImpl();
    @Override
    public Long findByTotal(AnnouncementPage announcementPage) {
        //验证有没有值
        if(announcementPage.getSelectMonth()==null  ||  announcementPage.getSelectMonth().trim().length()==0){
            announcementPage.setSelectMonth(null);
        }
        if(announcementPage.getAnnouncementTitle()==null  ||  announcementPage.getAnnouncementTitle().trim().length()==0){
            announcementPage.setAnnouncementTitle(null);
        }
        return   announcementDao.findByTotal(announcementPage);
    }

    @Override
    public List<Announcement> findByPage(AnnouncementPage announcementPage) {
        return announcementDao.findByPage(announcementPage);
    }

    @Override
    public boolean updatAnnouncement(Announcement announcement) {
        return announcementDao.updatAnnouncement(announcement);
    }

    @Override
    public boolean addAnnouncement(Announcement announcement) {
        return announcementDao.addAnnouncement(announcement);
    }

    @Override
    public boolean deleteAnnouncement(Integer announcementId) {
        return announcementDao.deleteAnnouncement(announcementId);
    }
}
